<?php
$testM = new test();
$testM->getCode();
class test{
    function getCode(){
        var_dump($_GET['code']) ;
        $code = $_GET['code'];
        $appid = 'wxb6739cb059886ffd';
        $secret = 'afe7e8637548433204e14adf295a3f8b';
        $getToken =   'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$appid.'&secret='.$secret.'&code='.$code.'&grant_type=authorization_code';
        $token=explode('"',file_get_contents($getToken));
       // $access_token = ;
        //$openid='oGSNr0_BQHP1oZxIqdTzwXTmR_Fs';
        var_dump($token[3],555555,$token[13]);
        $userInfo=file_get_contents('https://api.weixin.qq.com/sns/userinfo?access_token='.($token[3].'&openid='.$token[13].'&lang=zh_CN'));
        var_dump($userInfo);
    }
}
?>